package com.calm.singleton

import android.util.Log

class KLazySingleton private constructor(){
    companion object {
        //原生写法
        val INSTANCE by lazy(LazyThreadSafetyMode.NONE) {
            KLazySingleton()
        }
        //翻译Java
        private var INSTANCE1:KLazySingleton? = null
        fun getInstance():KLazySingleton{
            if(INSTANCE1 == null){
                INSTANCE1 = KLazySingleton()
            }
            return INSTANCE1!!
        }
    }
    fun sayHello(name:String){
        Log.e(this::class.java.simpleName,"Hell $name,nice to meet you !")
    }
}